// CherryMerry ( Mikhail Tomilenko ), Reverse Entertainment, 2021-2024

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "PlayerLevelManager.generated.h"


UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class NIFESTGAME_API UPlayerLevelManager : public UActorComponent
{
	GENERATED_BODY()

public:	
	UPlayerLevelManager();

protected:
	virtual void BeginPlay() override;

	/* Variablrs */
	int32 CalculatedLVL;

	/* Functions */
	virtual void OnLVLUp(int32 NewLVL, float NewPercentOnLVL);

	int32 MaxEXPFromLVL(int32 LVL);

	int32 CalculateLVLFromEXP(int32 EXPToCalculateLVL);

	float CalculateLVLPercentFromEXP(int32 EXPToCalculatePercent);

public:
	/* Variables */
	UPROPERTY(BlueprintReadOnly)
	int32 CurrentEXP;

	UPROPERTY(BlueprintReadOnly)
	int32 MaxEXP;

	UPROPERTY(BlueprintReadOnly)
	int32 MaxEXPOnLVL;

	UPROPERTY(BlueprintReadOnly)
	int32 CurrentLVL;

	UPROPERTY(BlueprintReadOnly)
	int32 MaxLVL;

	UPROPERTY(BlueprintReadOnly)
	float PercentOnLVL;

	/* Functions */
	float GetHealthFromLVL(int32 LVL);
	float GetShieldFromLVL(int32 LVL);
	virtual void UpdateLVL();

	UFUNCTION(BlueprintCallable)
	virtual void TakeEXP(int32 EXPToAdd);
};
